<!DOCTYPE html>
<html>
<head>
<title>{$site_name}</title>
<meta name="keywords" content="{$site_seo_keywords}" />
<meta name="description" content="{$site_seo_description}">

<tc_include file="Public:head" />
</head>

<style type="text/css">
.panel-default {
    border:solid 1px #DDD;
	box-sizing: border-box;
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
    font-size: 14px;
    line-height: 1.42857;
    color: #333;

}

.panel {
    margin-bottom: 20px;
    background-color: #FFF;
    border: 1px solid #F5F5F5;
    border-radius: 4px;
    box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading   {
    color: #333;
    background-color: #F5F5F5;
    border-color: #DDD;
}
.panel-heading {
    padding: 10px 15px;
    border-bottom: 1px solid transparent;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}
.panel-title {
    margin-top: 0px;
    margin-bottom: 0px;
    font-size: 16px;
    color: inherit;
}
.panel-body {
    padding: 15px;
}	
.row {
    margin-right: -15px;
    margin-left: -15px;
}
.col-lg-6 {
    width: 20%;
	float: left;
	position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
	
}
.col-lg-12 {
	position: relative;
    height: 40px;
	line-height:40px;
	margin-top:30px;
margin-right: 30px;
margin-left: 30px;
	
	border-bottom:1px #ddd solid;
	
	
}
.col-lg-5{
	width: 25%;
	float: left;
	padding-right: 30px;
    padding-left: 30px;
}
.divc{
	padding:15px; font-size:12px;border:solid 1px #f5f5f5; text-index:2em;
	margin-top:15px;
}
input.adloc{ margin-left:15px;}
.itemc{ margin-top:20px;}



</style>

<body class="body-white" id="top">
	<tc_include file="Public:nav" />

		<div class="container tc-main">
                <div class="row">
                    <div class="span3">
	                    <tc_include file="Public:usernav"/>
                    </div>
                    <div class="span9">
                           <div class="tabs">
                               <ul class="nav nav-tabs">
                                   <li class="active"><a href="#one" data-toggle="tab"><i class="fa fa-lock"></i> 添加求推广任务</a></li>
                               </ul>
                               <div class="tab-content">
                                  
                                   <div class="tab-pane active" id="one">
                                   			
                                   		
                                
                                  		<div class="panel panel-default">
										  <div class="panel-heading">请选择推广方式</div>
										  <div class="panel-body">
										  
										  
											   	<div class="row">
											   		
											   			<div class="col-lg-6">
												        	<input type="radio" value="1" name="tid"  class="testid" <if condition='$tid eq 1'>checked</if> />  &nbsp;&nbsp; 公众号推广
												  			<div class="divc">
												  				可以自由指定对应的公众号，公众号用户将推广需求群发推送给目标粉丝，适合大范围推广，传播更精准，转化率更高。
												  			
												  			
												  			</div>
												  		</div>
											   		
											   			<div class="col-lg-6">
												        	<input type="radio" value="2" name="tid"  class="testid"  <if condition='$tid eq 2'>checked</if> />  &nbsp;&nbsp; 朋友圈推广
												  			<div class="divc">
												  				自由指定对应的朋友圈红人，红人将推广需求直发或分享给目标粉丝，适合中小范围推广，转化率高。

												  			</div>
												  		</div>
												  		
												  		<div class="col-lg-6">
												        	<input type="radio" value="3" name="tid"  class="testid"  <if condition='$tid eq 3'>checked</if>   />  &nbsp;&nbsp; 广投推广
												  			<div class="divc">
												  				任务将发布到任务大厅中，价格更低，适合小范围传播。

												  			</div>
												  		</div>

												</div>
												<style type="text/css">
													.changUser{ padding:20px;  }
													.changUser h2{ font-size:12px; }
													.xiangmulist{ border:solid 1px #f5f5f5; min-height:40px;  }
													.xiangmulist .list{ line-height:25px; font-size:12px;padding:5px; border-bottom:solid 1px #f5f5f5;  }
													.xiangmulist .list .list_left{
																  float:left; width:100px; text-align:right; padding:0px;line-height:25px; 
														
													}
													.xiangmulist .list .list_right{  float:left; margin-left:20px;padding:0px; line-height:25px;width:630px;   }
													.xiangmulist .list .list_right span{ display:inline-block; padding-left:10px;
															padding-right:10px; cursor:pointer;
													}
													.xiangmulist .list .list_right span:hover, span.bg{ background:#CC3;}
													.clear{ clear:both; }
													.table{ font-size:11px;}
												</style>
												
												
													<style type="text/css">
															.pubhao{ height:40px; margin:5px;  width:360px; padding-left:10px; padding-right:10px;background-color:#f9f9f9; border:solid 1px #e5e5e5; float:left; }
															.pubhao span{ display:block; margin:8px 4px; float:right;}
															.pubhao .pubname{float:left; width:150px; overflow:hidden;}
															.pubhao .closed{padding:0 5px; background-color:red; color:#fff; height:20px; line-height:20px; margin:4px; cursor:pointer;   }
															.pubhao .mcolor{ color:#808080}	
															.countInt ,.Jixuadd{ color:red; cursor:pointer}
															
													</style>
												
												
												
											 <if condition='$tid eq 1'>
												<div class="changUser">
														<h2>请先挑选微信公众号：</h2>
														<div class="xiangmulist" >
															<div class="list">
																		<div class="list_left">常见分类：</div>
																		<div class="list_right">
																			
																			 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'jf'=>$jf,'fsl'=>$fsl,'cls'=>''))}"><span <if condition="$cls eq ''">class="bg"</if> >不限</span></a>
																			<volist name="class" id="cp">
																			 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'jf'=>$jf,'fsl'=>$fsl,'cls'=>$key))}"><span <if condition="$cls eq $key">class="bg"</if> >{$cp}</span></a>
																			</volist>
																		</div>
																		<div class="clear"></div>
															</div>		
															<div class="list">
																		<div class="list_left">积分：</div>
																		<div class="list_right">
																			
																			<volist name="jifenArr" id="cv">
																				 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'fsl'=>$fsl,'cls'=>$cls,'jf'=>$key))}"><span <if condition="$jf eq $key">class="bg"</if> >{$cv}</span></a>
																			</volist>
																			
																			
																		</div>
																		<div class="clear"></div>
															</div>		
															<div class="list">
																		<div class="list_left">粉丝量：</div>
																		<div class="list_right">
																		
																			<volist name="fensiLiang" id="cv">
																				 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'cls'=>$cls,'jf'=>$jf,'fsl'=>$key))}"><span <if condition="$fsl eq $key">class="bg"</if> >{$cv}</span></a>
																			</volist>
																			</span>
																		</div>
																		<div class="clear"></div>
															</div>			
														
														</div>
												
												
												
												<table class="table table-bordered table-striped table-hover">
												    <thead>
												      <tr>
												       	<th width="40">选择</th>
												        <th width="80">公众号名称</th>
												        <th width="50">粉丝量</th>
												        <th width="80">单图文报价</th>
												        <th width="110">多图文第一条报价</th>
												        <th width="120">多图文第二条报价</th>
												        <th width="120">多图文第三条-N条报价</th>
												        <th>接单数</th>
												      </tr>
												    </thead>
												    <tbody>
												  	<volist name="data" id="vo">
												  	<tr>
												  		<td><input type="checkbox" class="chileuser" name="chileuser[{$vo.wid}]" value="{$vo.wid}" /></td>
												  		<td>{$vo.pwc_name}</td>
												  		<td>{$vo.pwc_fsnum}</td>
												  		<td>{$vo.price_d }</td>
												  		<td>{$vo.price_f}</td>
												  		<td>{$vo.price_s}</td>
												  		<td>{$vo.price_o}</td>
												  		<td>0</td>
												  	</tr>
												     </volist>
												   
												    </tbody>
												  </table>
											
												   <div class="pager">{$pager}</div>	
													
													
													<button type="button" class="btn btn-primary btn-lg" style="margin-bottom:15px; border-radius:5px;" id="adduserAcct"  >添加账号</button>
												
												</div>
												
												<div class="Writeconents" style="display:none">
												
													
												<form class="form-horizontal J_ajaxForm" action="{:U('user/task/addshare',array('types'=>'pubwec'))}" method="post">
													<div class="itemc">
														广告位：<input type="radio" name="loction" value="1" class="adloc" checked >单图文
															<input type="radio" name="loction" value="2"  class="adloc" >第一条
															<input type="radio" name="loction" value="3"  class="adloc" >第二条
															<input type="radio" name="loction" value="4"  class="adloc" >第三-N条
													</div>	
													<div class="itemc">
														您已经挑选的微信公众号：<br />
														<div id="readyUser">
																已经挑选的公众号
														</div>
													</div>
													<div style="clear:both"></div>
													<div class="itemc">
														总积分：<span class="countInt" >0</span>　<span class="Jixuadd" id="Jixuadd">增加微信号</span>
													</div>
													<div class="itemc">
														标题：<input type="text" name="title" value="" class="span4" placeholder="显示在微信里面的标题" />
													</div>
													<div class="itemc">
														封面：<input type="text" id="fm" class="span2" placeholder="封面" name="cover" value="" readonly="readonly" />
                                   						<input type="file" onchange="avatar_upload(this,'#fm');" id="avatar_uploder"  name="file"  style="vertical-align:top;"  />
														
														
													</div>

													
													<div class="itemc">
														正文:<br/>
														<script type="text/javascript">
											                //编辑器路径定义
											               // var editorURL = GV.DIMAUB;
											                </script>
											                <script type="text/javascript"  src="__ROOT__/statics/js/ueditor/ueditor.config.js"></script>
											                <script type="text/javascript"  src="__ROOT__/statics/js/ueditor/ueditor.all.min.js"></script>
															<script type="text/javascript">
															    var editorcontent = new baidu.editor.ui.Editor();
															    editorcontent.render('content');
															</script>
											        		<script type="text/plain" id="content" name="content">{$options.template}</script>
															<style type="text/css">
															.content_attr {
																border: 1px solid #CCC;
																padding: 5px 8px;
																background: #FFC;
																margin-top: 6px
															}
															</style>
													
													</div>
													
													<div class="itemc">
													      封面是否显示在正文中：<input type="radio" name="isfmshowc" value="1" checked >是  <input type="radio" value="0" name="isfmshowc" >否
													</div>
													
													<div style="height:50px;"></div>
													<div class="itemc">
														原文链接：<input type="text" class="span4" name="oldurl" value="" />
													</div>
													
													<div class="itemc">
													开始时间：<input type="text" class="input-small J_date date" name="starttime" placeholder="开始时间" >
													</div>
													
													
													<button type="submit" class="btn J_ajax_submit_btn">提交</button>
													</form>
												</div>
												
												
												
												
												
												
							
											<elseif condition='$tid eq 2'/>	
												<div class="changUser">
														<h2>请先挑选微信朋友圈红人：</h2>
														<div class="xiangmulist" >
															<div class="list">
																		<div class="list_left">圈子分类：</div>
																		<div class="list_right">
																			
																			 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'jf'=>$jf,'fsl'=>$fsl,'cls'=>''))}"><span <if condition="$cls eq ''">class="bg"</if> >不限</span></a>
																			<volist name="class" id="cp">
																			 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'jf'=>$jf,'fsl'=>$fsl,'cls'=>$key))}"><span <if condition="$cls eq $key">class="bg"</if> >{$cp}</span></a>
																			</volist>
																		</div>
																		<div class="clear"></div>
															</div>		
															<div class="list">
																		<div class="list_left">积分：</div>
																		<div class="list_right">
																			
																			<volist name="jifenArr" id="cv">
																				 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'fsl'=>$fsl,'cls'=>$cls,'jf'=>$key))}"><span <if condition="$jf eq $key">class="bg"</if> >{$cv}</span></a>
																			</volist>
																			
																			
																		</div>
																		<div class="clear"></div>
															</div>		
															<div class="list">
																		<div class="list_left">好友数：</div>
																		<div class="list_right">
																		
																			<volist name="fensiLiang" id="cv">
																				 <a href="{:U('user/task/assignment',array('id'=>$id,'tid'=>$tid,'cls'=>$cls,'jf'=>$jf,'fsl'=>$key))}"><span <if condition="$fsl eq $key">class="bg"</if> >{$cv}</span></a>
																			</volist>
																			</span>
																		</div>
																		<div class="clear"></div>
															</div>			
														
														</div>
														
												<table class="table table-bordered table-striped table-hover">
												    <thead>
												      <tr>
												       	<th width="40">选择</th>
												        <th width="80">账号名称</th>
												        <th width="50">好友数</th>
												        <th width="80">报价</th>
												        <th width="110">好友圈子</th>
												        <th width="120">所在地</th>
												        <th width="120">年龄</th>
												        <th>性别</th>
												      </tr>
												    </thead>
												    <tbody>
												<volist name="data" id="vo">
												  	<tr>
												  		<td><input type="checkbox" class="chileuser" name="chileuser[{$vo.wid}]" value="{$vo.wid}" /></td>
												  		
												  		<td>{$vo.nickname}</td>
												  		<td>{$vo.friendnum}</td>
												  		<td>{$vo.price}</td>
												  		<td></td>
												  		<td>{$vo.province}-{$vo.city}</td>
												  		<td>{$vo.eag}</td>
												  		<td><if condition="$vo['sex'] eq 1">男<elseif condition="$vo['sex'] eq 2" />女<else />保密</if></td>
												  	</tr>
												 </volist>
   										   	
												    </tbody>
												   </table>
												   
												   
												   
												 <button type="button" class="btn btn-primary btn-lg" style="margin-bottom:15px; border-radius:5px;" id="adduserAcct"  >添加账号</button>

												</div>
												<div class="Writeconents" style="display:none">
												
													
												<form class="form-horizontal J_ajaxForm" action="{:U('user/task/addshare',array('types'=>'friends'))}" method="post">
													
													<div class="itemc">
														您已经挑选的微信号：<br />
														<div id="readyUser">
																已经挑选的微信号
														</div>
													</div>
													<div style="clear:both"></div>
													<div class="itemc">
														总积分：<span class="countInt" >0</span>　<span class="Jixuadd" id="Jixuadd">增加微信号</span>
													</div>
													
													<div class="itemc">
														投放平台： 朋友圈
													</div>
													<div class="itemc">
														活动类型 ：
														<select name="taskact" id="taskact">
															<option value="1">分享</option>
															<option value="2">直发</option>
														</select>
													</div>
													
													<div class="itemc">
														任务名称：<input type="text" name="title" value="" class="span4" placeholder="任务名称" />
													</div>
													<div class="itemc taskact_2">
														配图：<span style="display:none;">点击添加附件</span>
														
														<input type="text" id="fm" class="span2"  name="peitu" value="" readonly="readonly" />
                                   						<input type="file" onchange="avatar_upload(this,'#fm');" id="avatar_uploder"  name="file"  style="vertical-align:top;"  />

													</div>
													
													<div class="itemc taskact_1">
														分享内容：<br />
														<textarea name="fjnr" style="height:200px; width:400px;" >		
														</textarea>
													</div>
													
													<div class="itemc">
														<span class="taskact_1">分享语：</span>
														<span class="taskact_2">直发内容：</span>
														<br />
														<textarea name="content" style="height:200px; width:400px;" >		
														</textarea>
													</div>
													
													

													<div class="itemc">
													开始时间：<input type="text" class="input-small J_date date" name="starttime" placeholder="开始时间" >
													</div>
													
													
													<button type="submit" class="btn J_ajax_submit_btn">提交</button>
													</form>
												</div>											
											
												
											<elseif condition='$tid eq 3' />
												<form class="form-horizontal J_ajaxForm" action="{:U('user/task/addshare',array('types'=>'guangtou'))}" method="post">
												<div class="itemc">
												
													微信号<br /><input type="text" class="span4" placeholder="微信号" name="wid">
												</div>
												<div class="itemc">
												
													微信二维码<br /><input type="text" class="span4" id="ercode" placeholder="微信二维码" name="ercode" readonly  >
														<input type="file" onchange="avatar_upload(this,'#ercode');" id="avatar_uploder5"  name="file"  style="vertical-align:top;"  />
												</div>
												<div class="itemc">
												
													请填写任务标题：<br /><input type="text" class="span4" placeholder="请填写任务标题"  name="title">
												</div>
											
												
												<div class="itemc">
												
													推广要求：<br /><textarea style="width:500px" cols="80" rows="8" name="askfor"></textarea>
												</div>
														
												
												<div class="itemc">
												
													审核标准：<br /><textarea style="width:500px"  cols="80" rows="8" name="standard"></textarea>
												</div>
														
												<div class="itemc">
													奖励积分：<br /><input type="text" class="span4" placeholder="奖励积分" name="integral">
												</div>
													<button type="submit" class="btn J_ajax_submit_btn">提交</button>
												</form>
											</if>			
											</div>	
										   
										  </div>
										</div>
										
			
                                  
                                   </div>
                               </div>							
                           </div>
                    </div>
                </div>

		<tc_include file="Public:footer" />

	</div>
	<!-- /container -->

	<tc_include file="Public:scripts" />
	<script type="text/javascript">
			var url="{:U('user/task/assignment',array('id'=>$id))}/tid/";
			$(".testid").click(function(){
				var tid=$(this).val();		
				window.location.href=url+tid;
			});
			
			var ajax=function($posturl,$data,func){
				$.ajax({
				type:"POST",
			    url: $posturl,
				data:$data,
				dataType:"JSON",
				success:func,
				error:function(e){}
			 	 });
			}	
			
			//avatar_upload("");
			function avatar_upload(obj,dr){
				var $fileinput=$(obj);
				var dr=$(dr);
				var id=$fileinput.attr("id");
				Wind.css("jcrop");
				Wind.use("ajaxfileupload","jcrop","noty",function(){
					$.ajaxFileUpload({
						url:"{:U('user/profile/updateImg')}",
						secureuri:false,
						fileElementId:id,
						dataType: 'json',
						data:{},
						success: function (data, status){
						
							if(data.status==1){
								
								dr.val(data.data.file);
								
							}else{
								noty({text: data.info,
		                    		type:'error',
		                    		layout:'center'
		                    	});
							}
							
						},
						error: function (data, status, e){}
					});
				});

				return false;
			}
			
	
	</script>
	 <if condition='$tid eq 1'>	
	<script type="text/javascript">	
		var posturl="{:U('user/task/getSelectPub')}"
		var getData={};
		$("#adduserAcct").click(function(){
	
			var data={};
			$(".chileuser:checked").each(function(i){
				data[i]=$(this).val();
			});
			
			ajax(posturl,{"chileuser":data,"temp":"pubwe"},function(msg){
				if(!msg.status)
				{  
					alert(msg.info);
				}else{
					$(".changUser").hide();	
					$(".Writeconents").show();
					getData=msg.info;
					$.inserData(msg.info,$("#readyUser"),1);
				
				}
			})
		});
		
		$(".adloc").click(function(){
			var loc=$(this).val();
			$.inserData(getData,$("#readyUser"),loc);
		});
		$.inserData=function($data,$objin,loc)
		{
			var str="";
			var jf=0;
			var field={1:"price_d",
					   2:"price_f",
					   3:"price_s",
					   4:"price_o",
			};
			var count=0;
			
			for(i in $data)
			{
				
				jf=$data[i][field[loc]];
				count=count+parseInt(jf);
				str+='<div class="pubhao" data_id="'+$data[i]['id']+'" >';
				str+='<span class="closed">x</span>';
				str+='<span class="mcolor">积分：'+jf+ '</span>';
				str+='<span class="mcolor">粉丝数：'+$data[i]['pwc_fsnum'] +'</span>';
				str+='<span class="pubname">'+$data[i]['pwc_name']+'</span>';
				str+='</div>';
			}	
			$objin.html(str);
			$(".countInt").html(count);
		}
		var delurl="{:U('user/task/delSelectPub')}";
		//判定删除 
		$(".closed").live("click",function(){
			var id=$(this).parent().attr("data_id");
			var _this=$(this);
			ajax(delurl,{"id":id,"temp":"pubwe"},function(msg){
				if(msg.status)
				{
					getData=msg.info;
					$.inserData(msg.info,$("#readyUser"),1);
					if($(".closed").length==0){  window.location.reload(); }
				}	
				
			});
		
		});
		
		
		$("#Jixuadd").click(function(){
			$(".changUser").show();	
			$(".Writeconents").hide();
		});
		
		
		
	</script>	
	<elseif condition='$tid eq 2'/>	
	<script type="text/javascript">	
		var posturl="{:U('user/task/getSelectPub')}";
		var getData={};
		$("#adduserAcct").click(function(){
	
			var data={};
			$(".chileuser:checked").each(function(i){
				data[i]=$(this).val();
			});
			
			ajax(posturl,{"chileuser":data,"temp":"friends"},function(msg){
				if(!msg.status)
				{  
					alert(msg.info);
				}else{
					$(".changUser").hide();	
					$(".Writeconents").show();
					getData=msg.info;
					$.inserData(msg.info,$("#readyUser"),1);
				}
			})
		});
		
		$.inserData=function($data,$objin,loc)
		{
			var str="";
			var count=0;
			var jf=0;
			for(i in $data)
			{
				jf=$data[i]["price"];
				str+='<div class="pubhao" data_id="'+$data[i]['wid']+'" >';
				str+='<span class="closed">x</span>';
				str+='<span class="mcolor">积分：'+jf+ '</span>';
				str+='<span class="mcolor">粉丝数：'+$data[i]['friendnum'] +'</span>';
				str+='<span class="pubname">'+$data[i]['nickname']+'</span>';
				str+='</div>';
				count=count+parseInt(jf);
			}	
			$objin.html(str);
			$(".countInt").html(count);
		}
		
			var delurl="{:U('user/task/delSelectPub')}";
		//判定删除 
		$(".closed").live("click",function(){
			var id=$(this).parent().attr("data_id");
		
			var _this=$(this);
			ajax(delurl,{"id":id,"temp":"friends"},function(msg){
				if(msg.status)
				{
					getData=msg.info;
					$.inserData(msg.info,$("#readyUser"),1);
					if($(".closed").length==0){  window.location.reload(); }
				}	
				
			});
		
		});
		
		$("#Jixuadd").click(function(){
			$(".changUser").show();	
			$(".Writeconents").hide();
		});
		
		$("#taskact").change(function(){
			var id=$(this).val();
			var hid=id==1?2:1;
			$(".taskact_"+id).show();
			
			$(".taskact_"+hid).hide();
		});
		$("#taskact").change();
	</script>
	
	
	
	<else />
	
	</if>
	
	
</body>
</html>